<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>nandpsu: xnandpsu_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">nandpsu
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xnandpsu__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xnandpsu_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example using the NAND driver (<a class="el" href="struct_x_nand_psu.html" title="The XNandPsu structure contains the driver instance data. ">XNandPsu</a>). </p>
<p>This example tests the erase, read and write features of the controller. The flash is erased and written. The data is read back and compared with the data written for correctness.</p>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>None.</p>
<pre>
 MODIFICATION HISTORY:</pre><pre> Ver   Who  Date        Changes
</p>
<hr/>
<p>
 1.0  nm   05/06/2014  First release.
      ms   04/10/17    Modified Comment lines to follow doxygen rules.
 1.4  nsk  10/04/2018  Added support for ICCARM Compiler.
 1.6  sd   31/03/2020  Fixed a gcc warning.
 1.9  akm  07/15/2021  Switch to best supported Data interface and Timing mode.
 1.12 akm  06/27/2023  Add support for system device-tree flow for example.
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:af83886f74df6ac5c0436711e1685a4e0"><td class="memItemLeft" align="right" valign="top">s32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xnandpsu__example_8c.html#af83886f74df6ac5c0436711e1685a4e0">NandReadWriteExample</a> (u16 NandDeviceId)</td></tr>
<tr class="memdesc:af83886f74df6ac5c0436711e1685a4e0"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function runs a test on the NAND flash device using the basic driver functions in polled mode.  <a href="#af83886f74df6ac5c0436711e1685a4e0">More...</a><br/></td></tr>
<tr class="separator:af83886f74df6ac5c0436711e1685a4e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1bab411b1440d7e50a6441d0fda23289"><td class="memItemLeft" align="right" valign="top">u8 ReadBuffer[TEST_BUF_SIZE]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xnandpsu__example_8c.html#a1bab411b1440d7e50a6441d0fda23289">__attribute__</a> ((aligned(64)))</td></tr>
<tr class="memdesc:a1bab411b1440d7e50a6441d0fda23289"><td class="mdescLeft">&#160;</td><td class="mdescRight">Block sized Read buffer.  <a href="#a1bab411b1440d7e50a6441d0fda23289">More...</a><br/></td></tr>
<tr class="separator:a1bab411b1440d7e50a6441d0fda23289"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xnandpsu__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function to execute the Nand Flash read write example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br/></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a1bab411b1440d7e50a6441d0fda23289"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u8 ReadBuffer [TEST_BUF_SIZE] __attribute__ </td>
          <td>(</td>
          <td class="paramtype">(aligned(64))&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Block sized Read buffer. </p>
<p>Block sized write buffer. </p>

</div>
</div>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function to execute the Nand Flash read write example. </p>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if the example has completed successfully.</li>
<li>XST_FAILURE if the example has failed.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xnandpsu__example_8c.html#af83886f74df6ac5c0436711e1685a4e0">NandReadWriteExample()</a>.</p>

</div>
</div>
<a class="anchor" id="af83886f74df6ac5c0436711e1685a4e0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">s32 NandReadWriteExample </td>
          <td>(</td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>NandDeviceId</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function runs a test on the NAND flash device using the basic driver functions in polled mode. </p>
<p>The function does the following tasks:</p>
<ul>
<li>Initialize the driver.</li>
<li>Erase the flash.</li>
<li>Write data to the flash.</li>
<li>Read back the data from the flash.</li>
<li>Compare the data read against the data Written.</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">NandDeviceId</td><td>is is the XPAR_&lt;NAND_instance&gt;_DEVICE_ID value from xparameters.h.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XST_FAILURE if failed.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="struct_x_nand_psu___config.html#ab4899a7c8ecd0cf281c6162cfdf00daf">XNandPsu_Config::BaseAddress</a>, <a class="el" href="struct_x_nand_psu___geometry.html#ad856c11878859904836081ecc3a632cc">XNandPsu_Geometry::BytesPerPage</a>, <a class="el" href="struct_x_nand_psu.html#ada90fdee8e87d8880eb6766d76e3ad2d">XNandPsu::Geometry</a>, <a class="el" href="group___overview.html#ga8268e05a9d1a0339dc2ec672d7dd8c79">XNandPsu_CfgInitialize()</a>, <a class="el" href="group___overview.html#ga22080a2813ff692c0b64e0bbd9715f91">XNandPsu_ChangeTimingMode()</a>, <a class="el" href="group___overview.html#ga37ffc74066c48716b787438f19b70684">XNandPsu_EnableDmaMode()</a>, <a class="el" href="group___overview.html#ga7fb413a5f75317e698fe97ba12fc7d44">XNandPsu_Erase()</a>, <a class="el" href="group___overview.html#ga4d6df6679bb2c84faa7bbec9f4e776ee">XNandPsu_LookupConfig()</a>, <a class="el" href="group___overview.html#gad7e291db556ad9d33fbd06aa6ab79cb6">XNandPsu_Read()</a>, and <a class="el" href="group___overview.html#gaf276d363e46822efd9ff8ee7b55b906c">XNandPsu_Write()</a>.</p>

<p>Referenced by <a class="el" href="xnandpsu__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
